package work.shyk.gaas;

import java.util.function.Function;

/**
 * description: <br>
 * createTime: 2021/2/20 17:23 <br>
 *
 * @author zzh
 */
public class TestLambda {

    public static Person test(Function<String, Person> supplier, String name) {
        return supplier.apply(name);
    }

    public static void main(String[] args) {
        Person zhangsan = test(Person::new, "zhangsan");
        System.out.println(zhangsan.getName());
        System.out.println(zhangsan.getAge());
    }
}


class Person {
    String name = "default";

    int age = 6;

    public Person() {
    }


    public Person(String name) {
        this.name = name;
    }


    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }


    public int getAge() {
        return age;
    }


    public void setAge(int age) {
        this.age = age;
    }
}